﻿<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;
using System.Data;
using Maticsoft.DBUtility;
public class Handler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string returnStr = "";
        //这里其实是context.Request.QueryString根据name获取的值 一定要设置空间的name值
        if (context.Request["userName"] != null && context.Request["userName"].ToString().Length > 0)
        {
            if (isExist(context.Request["userName"].ToString()))
            {
                returnStr = "false";
            }
            else
            {
                returnStr = "0";
            }
        }
        else
        {
            returnStr = "null";
        }
        context.Response.Write(returnStr);
        context.Response.End();
    }
    // 判断用户是否被注册过
    public bool isExist(string userName)
    {
        string str = "select count(ID) from TB_UserInfo where userName='" + userName + "'";
        object obj = DbHelperOleDb.GetSingle(str);
        bool result = Convert.ToInt32(obj) == 0 ? false : true;
        return result;
    }
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}